let form = layui.form
let id = new URLSearchParams(location.search).get('id')
function bianji() {
  $.ajax({
    url: '/admin/users/'+id,
    success: function(res) {
      if(status === 0) {
        form.val('editForm', res.data)
          } else {
        layer.msg(res.message)
      }
    }
  })
}
bianji()

$('.layui-form').submit(function (e) {
  e.preventDefault()
  var fd = $(this).serialize()
  $.ajax({
    type: 'put',
    url: '/admin/users',
    data: fd,
    success: function (res) {
      layer.msg(res.message)
    }
  })
})